package com.bdqn.qnnews.schedule.api.feign;

import com.bdqn.qnnews.schedule.api.dto.TaskDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author xlzhang
 * @date 2024/1/17 9:58
 */
@FeignClient(value = "qnnews-schedule-service",path = "/api/task")
public interface TaskFeignClient {

    /**
     * 添加延迟队列任务
     */
    @PostMapping("/add")
    public Long addTask(@RequestBody TaskDto task);

    /**
     * 消费任务
     */
    @PostMapping("/poll/{taskTopic}")
    public List<TaskDto> pollTask(@PathVariable(value = "taskTopic") Integer taskTopic);
}
